package net.xo68.destiny.core.store.enums;

/**
 * 存储页的种类
 * @author wuxie
 * @version 2021-1-6
 */
public enum StorePageKind {

    /**
     * 索引页
     */
    INDEX((byte)1),
    /**
     * 数据页
     */
    DATA((byte)2);

    private final byte code;

    StorePageKind(byte code) {
        this.code = code;
    }

    public byte getCode() {
        return code;
    }

    public static StorePageKind of(byte code){
        for (StorePageKind pageType : StorePageKind.values()){
            if(pageType.getCode() == code){
                return pageType;
            }
        }
        return null;
    }
}
